import ajax from '../js/ajax';

const form = document.forms.reg;

form.onsubmit = function (e) {
    e.preventDefault();
    ajax('post', '/api/admin/reg', { uid: form.uid.value, pwd: form.pwd.value })
        .then(({ flag, msg }) => {
            if (flag) {
                alert(msg);
            } else {
                alert(msg);
            }
        })
        .catch(err => {
            alert('服务器忙，请稍后再试');
        })
}